package top.huxy.boot.config.schedule;

import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
import org.springframework.stereotype.Component;
import top.huxy.boot.BlogApiApplication;

/**
 * @Classname TestSchedult
 * @Description TestSchedult
 * @Date 2021/9/18 12:08
 * @Created by huxy
 */
@Component
@ConditionalOnProperty(name = "spring.profiles.active",havingValue = "dev")
public class TestSchedule {

    public String sayHello(){
        System.out.println("hello");
        TestSchedule bean = BlogApiApplication.app.getBean(TestSchedule.class);
        bean.error();
        return "hello";
    }


    public String say(String msg){
        return msg;
    }

    public void error(){
        throw new RuntimeException("假装错误");
    }
}
